<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    518. Coin Change 2
   </h1>
   <p>
    You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that amount. You may assume that you have infinite number of each kind of coin.
   </p>
   <ul>
   </ul>
   <p>
    &nbsp;
   </p>
   <p>
    <b>
     Example 1:
    </b>
   </p>
   <pre>
<b>Input:</b> amount = 5, coins = [1, 2, 5]
<b>Output:</b> 4
<b>Explanation:</b> there are four ways to make up the amount:
5=5
5=2+2+1
5=2+1+1+1
5=1+1+1+1+1
</pre>
   <p>
    <b>
     Example 2:
    </b>
   </p>
   <pre>
<b>Input:</b> amount = 3, coins = [2]
<b>Output:</b> 0
<b>Explanation:</b> the amount of 3 cannot be made up just with coins of 2.
</pre>
   <p>
    <b>
     Example 3:
    </b>
   </p>
   <pre>
<b>Input:</b> amount = 10, coins = [10] 
<b>Output:</b> 1
</pre>
   <p>
    &nbsp;
   </p>
   <p>
    <b>
     Note:
    </b>
   </p>
   <p>
    You can assume that
   </p>
   <ul>
    <li>
     0 &lt;= amount &lt;= 5000
    </li>
    <li>
     1 &lt;= coin &lt;= 5000
    </li>
    <li>
     the number of coins is less than 500
    </li>
    <li>
     the answer is guaranteed to fit into signed 32-bit integer
    </li>
   </ul>
  </div>
  <div>
   <h1 class="question_title">
    518. 零钱兑换 II
   </h1>
   <p>
    给定不同面额的硬币和一个总金额。写出函数来计算可以凑成总金额的硬币组合数。假设每一种面额的硬币有无限个。&nbsp;
   </p>
   <p>
    &nbsp;
   </p>
   <ul>
   </ul>
   <p>
    <strong>
     示例 1:
    </strong>
   </p>
   <pre><strong>输入:</strong> amount = 5, coins = [1, 2, 5]
<strong>输出:</strong> 4
<strong>解释:</strong> 有四种方式可以凑成总金额:
5=5
5=2+2+1
5=2+1+1+1
5=1+1+1+1+1
</pre>
   <p>
    <strong>
     示例 2:
    </strong>
   </p>
   <pre><strong>输入:</strong> amount = 3, coins = [2]
<strong>输出:</strong> 0
<strong>解释:</strong> 只用面额2的硬币不能凑成总金额3。
</pre>
   <p>
    <strong>
     示例 3:
    </strong>
   </p>
   <pre><strong>输入:</strong> amount = 10, coins = [10] 
<strong>输出:</strong> 1
</pre>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     注意
    </strong>
    <strong>
     :
    </strong>
   </p>
   <p>
    你可以假设：
   </p>
   <ul>
    <li>
     0 &lt;= amount (总金额) &lt;= 5000
    </li>
    <li>
     1 &lt;= coin (硬币面额)&nbsp;&lt;= 5000
    </li>
    <li>
     硬币种类不超过 500 种
    </li>
    <li>
     结果符合 32 位符号整数
    </li>
   </ul>
  </div>
 </body>
</html>